<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<script language="JavaScript">
	function goToNext()
	{
			if(CheckPasswd('olsPassword_id','password_id','con_password_id') == true)
			{
				document.changePasswordForm.action='changePassword.do?changemode=chng_password';
				document.changePasswordForm.submit();
			}
			else
				return;			
	}
	function CheckPasswd(oldPwd,passwd,repasswd)
	{
		if(document.getElementById(oldPwd).value == '' || document.getElementById(passwd).value == '' ||document.getElementById(repasswd).value == ''  )
		{
			alert("Please fille all the mandatory fields ");
			return false;
		}
		if(document.getElementById(oldPwd).value != ''){
			if(document.getElementById(oldPwd).value == document.getElementById(passwd).value)
			{
				alert("Old Password and New Password cannot be same");				
				document.getElementById(passwd).value = "";
				document.getElementById(repasswd).value = "";
				return false;
			}
		}
		if(document.getElementById(passwd).value == "")
		{
			alert("Password can not be blank");			
			return false;		
		}
		if(document.getElementById(passwd).value != document.getElementById(repasswd).value)
		{
			alert("New Password and Confirm Password should be same");			
			document.getElementById(passwd).value = "";
			document.getElementById(repasswd).value = "";
			return false;
		}	
		if(document.getElementById(passwd).value.indexOf(" ")!= -1)
		{
			alert("Space charactor is not allowed in passoword ");
			return false;
		}	
		else
			return true;
	}
</script>
<html:form action="/changePassword.do" >
	<table width="550" align="center" border="0" cellspacing="0" cellpadding="0" >
      <tr>
			<td>&nbsp;</td>
	  </tr>
	  <tr>            
            <td  class="heading1">Change Password Form</div></td>            
      </tr>
	  <tr><td>&nbsp;</td></tr>
      <tr>            
            <td valign="top"><jsp:include page="showErrorMessage.jsp"/></td>            
      </tr>
	 <tr>
		<td valign="top">
		<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
			  <tr>
				<td height="30" valign="middle" class="tbletext">User ID<span class="asterix">*</span></td>
				<td valign="middle" class="text1"><label>
				  <html:text property="userID" styleClass="form1" readonly="true"/>
				</label></td>
				</tr>
			  <tr>
				<td height="30" valign="middle" class="tbletext">Old Password<span class="asterix">*</span></td>
				<td valign="middle" class="text1"><label>
				  <html:password property="oldPassword" maxlength="20" styleId="olsPassword_id" styleClass="form1"/>
				</label></td>
			  </tr>
			  <tr>
				<td height="30" valign="middle" class="tbletext">New Password<span class="asterix">*</span></td>
				<td valign="middle" class="text1"><label>
				  <html:password property="password" maxlength="20" styleId="password_id" styleClass="form1"/>
				</label></td>
			  </tr>
			  <tr>
				<td height="30" valign="middle" class="tbletext">Confirm Password<span class="asterix">*</span></td>
				<td valign="middle" class="text1"><label>
				  <html:password property="conPassword" maxlength="20" styleId="con_password_id" styleClass="form1"/>
				</label></td>
			  </tr>
			  <tr><td>&nbsp;</td></tr>
			  <tr>
                <td colspan="4" valign="top"  bgcolor="#CCCCCC"><img src="images/zero.gif" width="1" height="1" /></td>
	         </tr>
			  <tr>
				<td height="30" valign="middle" class="tbletext">&nbsp;</td>
				<td valign="middle" class="tbletext"><label>
				  <span class="asterix"><div id="changepasswd_div"></div></span>
				</label></td>
			  </tr>			  
			  <tr>
				<td valign="top">&nbsp;</td>
				<td valign="middle">
				<input type="button"  class="imageButton" value="Save" onClick="goToNext();"> 
				</td>            
			  </tr>
			</table>
		</td>
			  </tr>
            </table>    
	<html:hidden property="changemode" />
	<html:hidden property="logout" />
	<html:hidden property="password_Changed" styleId="password_Changed_id"/>
</html:form>

